package gui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ProgressBar;

public class ProgressComposite extends Composite {

	/**
	 * Create the composite.
	 * 
	 * @param parent
	 * @param style
	 */
	public ProgressComposite(Composite parent, int style,
			double progressInPercent) {
		super(parent, style);
		setLayout(new GridLayout(2, false));

		ProgressBar progressBar = new ProgressBar(this, SWT.NONE);
		progressBar.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false,
				false, 1, 1));
		int progressInPercentInt = (int) (progressInPercent);
		String progressString = Integer.toString(progressInPercentInt) + " %";
		progressBar.setSelection(progressInPercentInt);
		progressBar.setToolTipText(progressString);

		Label lblProgress = new Label(this, SWT.NONE);
		lblProgress.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false,
				false, 1, 1));
		lblProgress.setText(progressString);
	}

}
